import sys
import pygame
import os
import Settings

x = 1440
y = 750
class Button:
    def __init__(self, x, y, width, height, text):
        self.body = pygame.Rect(x,y, width, height)
        self.text = text

b1 = Button(100, 500, 100, 20, "Начать игру")
b2 = Button(100, 550, 100, 20, "Настройки")
b3 = Button(100, 600, 100, 20, "Выход")
pygame.init()
screen = pygame.display.set_mode((x, y))
f = pygame.font.Font(None, 22)
text1 = f.render(b1.text, True, (255,0,0))
text2 = f.render(b2.text, True, (255,0,0))
text3 = f.render(b3.text, True, (255,0,0))
while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()
        #"""elif event.type == pygame.K_ESCAPE:
          #  pygame.quit()
          #  sys.exit()"""
        elif event.type == pygame.MOUSEBUTTONDOWN:
            if event.pos[0]>b1.body.x and event.pos[0]<b1.body.x+b1.body.width and event.pos[1]>b1.body.y and event.pos[1]<b1.body.y+b1.body.height:
                print('kurs')
                os.system('python kurs.py')#Пока так
            elif event.pos[0]>b2.body.x and event.pos[0]<b2.body.x+b2.body.width and event.pos[1]>b2.body.y and event.pos[1]<b2.body.y+b2.body.height:
                Settings.start()
            elif event.pos[0]>b3.body.x and event.pos[0]<b3.body.x+b3.body.width and event.pos[1]>b3.body.y and event.pos[1]<b3.body.y+b3.body.height:
                pygame.quit()
                sys.exit()
    screen.fill((0, 0, 0))
    pygame.draw.rect(screen, (0, 0, 0), b1.body)
    pygame.draw.rect(screen, (0, 0, 0), b2.body)
    pygame.draw.rect(screen, (0, 0, 0), b3.body)
    screen.blit(text1, (b1.body.x, b1.body.y))
    screen.blit(text2, (b2.body.x, b2.body.y))
    screen.blit(text3, (b3.body.x, b3.body.y))
    pygame.display.update()